﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EWMSWeb.Code
{
    public class BarclodevValue
    {
        public BarclodevValue()
		{}
		#region Model
        private string _isau;
        private string _indepart;
        private string _outdepart;
        private string _cumcode;
        private string _cumname;
        private List<DataLib.Model.BarCode> _mlist;
        private DataLib.Model.OutStorage _omodel;

        /// <summary>
		/// 返回消息
		/// </summary>
        public string isau
		{
            set { _isau = value; }
            get { return _isau; }
		}

        /// <summary>
        /// 归属地
        /// </summary>
        public string indepart
        {
            set { _indepart = value; }
            get { return _indepart; }
        }

        /// <summary>
        /// 处理地
        /// </summary>
        public string outdepart
        {
            set { _outdepart = value; }
            get { return _outdepart; }
        }

        /// <summary>
        /// 客户编码
        /// </summary>
        public string cumcode
        {
            set { _cumcode = value; }
            get { return _cumcode; }
        }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string cumname
        {
            set { _cumname = value; }
            get { return _cumname; }
        }

        /// <summary>
        /// 出库单
        /// </summary>
        public DataLib.Model.OutStorage omodel
        {
            set { _omodel = value; }
            get { return _omodel; }
        }

        /// <summary>
        /// 条码集合
        /// </summary>
        public List<DataLib.Model.BarCode> mlist
        {
            set { _mlist = value; }
            get { return _mlist; }
        }

    }
        #endregion

    public static class GetBarcodeValueData
    {
        public static BarclodevValue GetBarcodeValues(string barcodevalue,string outType,string oldload)
        {

            DataLib.Model.BarCode barModel = new DataLib.Model.BarCode();
            DataLib.BLL.OutStorage outBll = new DataLib.BLL.OutStorage();
            string isau = "";
            barModel = outBll.OutBarCodeConfirm(barcodevalue, outType, oldload, ref isau);

            BarclodevValue model = new BarclodevValue();
            DataLib.BLL.BarCode bll = new DataLib.BLL.BarCode();
            model.isau = isau;
            if (barModel != null)
            {
                if (barModel.barbelong != null)
                {
                    model.indepart = barModel.barbelong;
                }
                if (barModel.bargraphic != null)
                {
                    model.outdepart = barModel.bargraphic;
                }
                model.outdepart = barModel.bargraphic;
            }
            model.mlist = bll.GetModelList("(barcodevalue='" + barcodevalue + "' and OutStrorageID is null and status>-1)");
            return model;
        }
    }
}